package com.kcs.fxmargin.service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.kcs.common.utils.ConnectionUtils;
import com.kcs.common.utils.Constant;
import com.kcs.fxmargin.dao.CommonDao;

public class CommonService {
	CommonDao dao = new CommonDao();
	
	public int getRowVersion(String tableName, String id) throws Exception {
		
		Connection conn 			= null;
		PreparedStatement pstm 		= null;
		ResultSet rs				= null;
		int rowVersion 				= 0;
		
		try{
			conn = ConnectionUtils.getConnection(Constant.MSSQL, Constant.TO); // get connection fxmargin from mssql
			rowVersion = dao.getRowVersion(conn, pstm, rs, tableName, id);
			
		} catch (Exception e){
			e.printStackTrace();
		} finally {
			if(conn != null ) conn.close();
			if(pstm != null ) pstm.close();
			if(rs   != null ) rs.close();
		}
		
		return rowVersion;
	}

}
